package com.tang.controller;

import com.tang.dto.BookDTO;
import com.tang.dto.BookSnapshotDTO;
import com.tang.resp.JsonResp;
import com.tang.service.impl.BookSnapshotServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/bookSnapshot/*")
public class BookSnapshotController {
    @Autowired
    private BookSnapshotServiceImpl bookSnapshotService;

    @GetMapping("getStatistic")
    public JsonResp getStatistic(){
        JsonResp resp = new JsonResp();
        resp.setCode(200);
        resp.setMessage("查询快照成功");
        List<BookSnapshotDTO> statistic = bookSnapshotService.getStatistic();
        resp.setData(statistic);
        return resp;
    }
    @GetMapping("get30Statistic")
    public JsonResp get30Statistic(){
        JsonResp resp = new JsonResp();
        resp.setCode(200);
        resp.setMessage("查询快照成功");
        List<BookSnapshotDTO> statistic = bookSnapshotService.get30Statistic();
        resp.setData(statistic);
        return resp;
    }
}
